<template>
  <div class="side-item" @click="$router.push('/dynamic/' + sideInfo.id)">
    <!-- 作者信息 -->
    <author-item :badge_url="sideInfo.badge_url ? sideInfo.badge_url : ''" :img_url="sideInfo.send_user && sideInfo.send_user.avatar" :name="sideInfo.send_user.name" :id="sideInfo.send_user && sideInfo.send_user.id"></author-item>
    <!-- 视频 -->
    <video-com v-if="type == 'video_post'" :id="sideInfo.id" :img_url="sideInfo.pics[0].url" :title="sideInfo.title"></video-com>
    <!-- 图片展览 -->
    <!-- 十张图片信息 -->
    <ten-pic :count="sideInfo.pic_count" :img_url="sideInfo.pics[0].url" :title="sideInfo.title" v-else-if="(sideInfo.pics && sideInfo.pics.length >= 10) || sideInfo.pics.length == 1"></ten-pic>
    <!-- 九张图片 -->
    <nine-pic :imgs="sideInfo.pics" v-else-if="sideInfo.pics && sideInfo.pics.length == 9"></nine-pic>
    <!-- 八张图片 -->
    <eight-pic :imgs="sideInfo.pics" v-else-if="sideInfo.pics && sideInfo.pics.length == 8"></eight-pic>
    <!-- 七张图片 -->
    <seven-pic :imgs="sideInfo.pics" v-else-if="sideInfo.pics && sideInfo.pics.length == 7"></seven-pic>
    <!-- 六张图片 -->
    <six-pic :imgs="sideInfo.pics" v-else-if="sideInfo.pics && sideInfo.pics.length == 6"></six-pic>

    <business-desc :content="sideInfo.content ? sideInfo.content : ''" :title="sideInfo.pics.length < 10 ? sideInfo.title : ''"></business-desc>

    <appropriate-option :subjects="sideInfo.subjects ? sideInfo.subjects : []"></appropriate-option>

    <subject-box :like_count="sideInfo.like_count" :view_count="sideInfo.view_count"></subject-box>
  </div>
</template>

<script>
import EightPic from './EightPic.vue'
import NinePic from './NinePic.vue'
import TenPic from './TenPic.vue'
import SevenPic from './SevenPic.vue'
import SixPic from './SixPic.vue'
import VideoCom from './VideoCom.vue'
import AuthorItem from './AuthorItem.vue'
import SubjectBox from './SubjectBox.vue'
import BusinessDesc from './BusinessDesc.vue'
import AppropriateOption from './AppropriateOption.vue'
export default {
  props: {
    sideInfo: Object,
    type: String
  },
  components: {
    TenPic,
    NinePic,
    EightPic,
    SevenPic,
    SixPic,
    VideoCom,
    AuthorItem,
    SubjectBox,
    BusinessDesc,
    AppropriateOption
  },
  methods: {
    formatContent(content) {
      return content.split('\n')
    }
  }
}
</script>
<style lang="less" scoped>
.side-item {
  padding: 10px 0;
  background-color: #fff;
}
</style>
